<?php
/**
 * Created by PhpStorm.
 * User: huliren<huliren0516@163.com>
 * Date: 2017/10/27
 * Time: 15:32
 */
define("SITE_AUTH", 'recom-big-active');

require '../../../common.inc.php';

use Mobile\RecomData;
use lib\core\AdminAction;

class active extends AdminAction
{
    public function doDefault()
    {
        $citys = \Center\City::getAllCity();
        $city_list = [];
        foreach ($citys['data'] as $v) {
            $city_list[$v['CityId']] = $v['CityName'];
        }
        if (!empty($_POST)) {
            $update = [];
            foreach ($_POST as $k => $v) {
                list(/**/, $i) = explode('_', $k);
                $update[$i] = $v;
            }
            RecomData::setData(RecomData::APP_ACTIVE_BANNER, $update);
        }

        $smarty = $this->app->page();
        $data = RecomData::getData(RecomData::APP_ACTIVE_BANNER)[RecomData::APP_ACTIVE_BANNER];
        $smarty->value('citys', $city_list);
        $smarty->value('data', $data);
        $smarty->output('recom/big_active.tpl');
    }
}

$app->run();